#include "../src/base/SingletonThreadPool.h"
#include <iostream>

using namespace std;

void task()
{
    cout << "Hello World!" << endl;
}

int main()
{
    try
    {
        auto &pool = ThreadPool::getInstance();
        pool.append(std::function<void()>(task));
        pool.append(std::function<void()>(task));
        pool.append(std::function<void()>(task));
        pool.append(std::function<void()>(task));
        pool.append(std::function<void()>(task));
        pool.append(std::function<void()>(task));
        pool.append(ThreadPool::Task(task));
        // int i = 0;
        // while (true)
        // {
        //     i++;
        //     pool->append(std::function<void()>(task));
        //     if(i >= 1000) {
        //         pool->stop();
        //         break;
        //     }
        // }
        while (1)
            ;
    }
    catch (const exception &e)
    {
        e.what();
    }
}